package 递归;

import java.util.Scanner;

public class 小白上楼梯 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        System.out.println(slt(n));
    }
    static int slt(int n){
        if (n==1)return 1;
        if (n==2)return 2;
        if (n==3)return 4;
        return slt(n-1)+slt(n-2)+slt(n-3);
    }
}
